package org.javabasics.reflect;

import java.lang.reflect.Array;

/**
 * Created by LUOLIANG on 2016/9/18.
 * 通过反射的Array类创建数组
 */
public class ArrayTest {
    public static void main(String[] args) {
        Object arr = Array.newInstance(String.class, 10);
        Array.set(arr, 5, "测试数据1");
        Array.set(arr, 6, "测试数据2");
        Object str1 = Array.get(arr, 5);
        Object str2 = Array.get(arr, 6);
        System.out.println(str1);
        System.out.println(str2);
    }
}
